let db = require('../db/index')

exports.gethappy = (req, res) => {
    var sql = "select * from music where music_theme = 'happy'"
    db.query(sql, (err, data) => {
        if(err) {
            return res.send('错误：' + err.message)
        }
        // console.log(data)
        res.send(data)
    })
}


exports.getsad = (req, res) => {
    var sql = "select * from music where music_theme = 'sad'"
    db.query(sql, (err, data) => {
        if(err) {
            return res.send('错误：' + err.message)
        }
        // console.log(data)
        res.send(data)
    })
}

exports.getsweet = (req, res) => {
    var sql = "select * from music where music_theme = 'sweet'"
    db.query(sql, (err, data) => {
        if(err) {
            return res.send('错误：' + err.message)
        }
        // console.log(data)
        res.send(data)
    })
}

exports.gethappy_sad = (req, res) => {
    var sql = "select * from music where music_theme = 'happy,sad'"
    db.query(sql, (err, data) => {
        if(err) {
            return res.send('错误：' + err.message)
        }
        // console.log(data)
        res.send(data)
    })
}

exports.gethappy_sweet= (req, res) => {
    var sql = "select * from music where music_theme = 'happy,sweet'"
    db.query(sql, (err, data) => {
        if(err) {
            return res.send('错误：' + err.message)
        }
        // console.log(data)
        res.send(data)
    })
}

exports.getsad_sweet = (req, res) => {
    var sql = "select * from music where music_theme = 'sad,sweet'"
    db.query(sql, (err, data) => {
        if(err) {
            return res.send('错误：' + err.message)
        }
        // console.log(data)
        res.send(data)
    })
}

exports.getall = (req, res) => {
    var sql = "select * from music where music_theme = 'happy,sad,sweet'"
    db.query(sql, (err, data) => {
        if(err) {
            return res.send('错误：' + err.message)
        }
        // console.log(data)
        res.send(data)
    })
}
